"use strict"

const moment = require('moment')
module.exports = app => {
    const { INTEGER, DATE, STRING} = app.Sequelize
    const GoodsImgs = app.model.define('goods_imgs', {
        id: {
            type: INTEGER,
            autoIncrement: true,
            primaryKey: true,
        },
        goods_id: {
            type: INTEGER,
            allowNull: false
        },
        img_path: {
            type: STRING,
            allowNull: false
        },
        create_time: {
            type: DATE,
            allowNull: false,
            get() {
                return moment(this.getDataValue('create_time')).format('YYYY-MM-DD HH:mm:ss')
            }
        }
    });
    return GoodsImgs
}